﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace PPWMS.Log
{

    public class Logmanagement
    {
        private static string _defaultLogDri = Environment.CurrentDirectory + @"\Log\";

        public void WriteLog(string logData)
        {
            string logPathName = _defaultLogDri + DateTime.Now.Date.ToFileTime() + ".log";
            StringBuilder sb = new StringBuilder();
            string head = @"******[" + DateTime.Now.ToShortDateString() + @" " + DateTime.Now.ToShortTimeString() + @"]: ";
            sb.AppendLine(head + logData);
            if (!File.Exists(logPathName))
            {
                File.Create(logPathName);
            }
            File.AppendAllText(logPathName, sb.ToString(), Encoding.UTF8);
        }

    }
}
